home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Sample Code / AOCE Sample Code / PowerTalk Access Modules / Sample PMSAM / PMSAM Framework / RoboSamSlot / AOCEEnclosure.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-28  |  4.6 KB  |  195 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        TAOCEEnclosure.h
  3.  
  4.     Contains:    xxx put contents here xxx
  5.  
  6.     Written by:    David Akhond
  7.  
  8.     Copyright:    © 1994 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.          <2>     2/14/95    TMH        changed kReadBlockSize to kReadEnclosureBlockSize
  13.  
  14.     To Do:  
  15.     
  16.     
  17. */
  18.  
  19.  
  20.  
  21.  
  22.  
  23. #ifndef __TAOCEEnclosure__
  24. #define __TAOCEEnclosure__
  25.  
  26.  
  27. #ifndef __OCE__
  28. #include "OCE.h"
  29. #endif
  30.  
  31. #ifndef __OCEMESSAGING__
  32. #include "OCEMessaging.h"
  33. #endif
  34.  
  35. #ifndef __OCEMAIL__
  36. #include "OCEMail.h"
  37. #endif
  38.  
  39. #ifndef __FILES__
  40. #include    "Files.h"
  41. #endif
  42.  
  43.  
  44. #ifndef __MEMORY__
  45. #include "Memory.h"
  46. #endif
  47.  
  48. // #ifndef __TAOCEEncList__
  49. // #include "AOCEEncList.h"
  50. // #endif
  51.  
  52. class    TAOCEEncList;
  53. class    CEnclosFileSummaryList;
  54. class    CEnclosFileSummary;
  55. class    CFolder;
  56.  
  57.  
  58. enum {
  59.         kNoSuchDescriptor,
  60.         kDataForkDescriptor,
  61.         kResourceForkDescriptor,
  62.         kRealNameDescriptor,
  63.         kCommentDescriptor,
  64.         kBWIconDescriptor,
  65.         kColorIconDescriptor,
  66.         kUndeclaredDescriptor,
  67.         kFileDatesInfoDescriptor,
  68.         kFinderInfoDescriptor,
  69.         kMacFileInfoDescriptor
  70.  
  71. };
  72.  
  73.  
  74. struct    EntryDescriptor {
  75.     unsigned long        entryID;
  76.     unsigned long        entryOffset;
  77.     unsigned long        entryLength;
  78. };
  79.  
  80. #define        kReadEnclosureBlockSize        1024
  81.  
  82.  
  83. //------------------------------------------
  84. //        TAOCEEnclosure
  85. //------------------------------------------
  86.  
  87.  
  88. class    TAOCEEnclosure {
  89.  
  90. public:
  91.                             TAOCEEnclosure();
  92.                             ~TAOCEEnclosure();
  93.             void            IAOCEEnclosure(MailMsgRef        myMsgRef);
  94.             
  95.             OSErr            GetEnclosureBuffer();
  96.             OSErr            TraverseFile();                        // Takes you to the end of the current file. The next buffer received from MSAMGetEnclosure is the start of the next enclosed file/folder.
  97.             OSErr            NextFile();                            // goes to the next file index
  98.             OSErr            TraverseEnclosures();                // Takes you to the end of all enclosures. The next buffer received from MSAMGetEnclosure will start at the beginning of all enclosures again.
  99.  
  100.             Boolean            IsFile();                            // checks to see if current enclosure is a file (true) or a folder (false)
  101.             
  102.             OSType            EnclosureCreator();                    // returns the creator for the file
  103.             OSType            EnclosureType();                    // returns the type for the file
  104.             StringPtr        EnclosurePath();                    // returns a string which is the pathname for the enclosure
  105.             
  106.             void                RefreshBuffer();
  107.             
  108.             unsigned char        EnclByte();
  109.             unsigned short        EnclWord();
  110.             unsigned long        EnclLong();
  111.             void                EnclNBytes(void*    theBuff, unsigned long    countBytes);
  112.             
  113.             void                EnclSkipNBytes(unsigned long  countBytes);
  114.             
  115.             void                EnclCStr(char*    theCString);
  116.             void                EnclPStr(StringPtr    thePString);
  117.             void                EnclEntryDescrip(EntryDescriptor*    theEntry);
  118.             
  119.             void                GetFileInfo();
  120.             void                GetFileDescriptors();
  121.             
  122.             void                GoToFileIndex(unsigned long    desiredFileIndex);
  123.             void                GetAllFileParams();
  124.             void                GetNextFileParams();
  125.             
  126.             void                GetEnclosFileSummaryByIndex(unsigned short    theIndex, CEnclosFileSummary*    returnSummary);
  127.             
  128.             void                ResourceForkStart(unsigned long      fileIndex);
  129.             void                DataForkStart(unsigned long      fileIndex);
  130.             
  131.             void                AllEnclosures(CFolder*    theRootDir);
  132.  
  133.             
  134.  
  135. private:
  136.                             MSAMGetEnclosurePB        fGetEnclosurePB;
  137.                             MailMsgRef                fMsgRef;
  138.  
  139.  
  140.                             Boolean                    fFileStat;
  141.                             Boolean                  fEnclosuresStat;
  142.                             
  143.                             unsigned long            fCurrFileOffset;
  144.                             unsigned long            fCurrEnclosuresOffset;
  145.                             
  146.                             char                    fEnumBlocksBuffer[kReadEnclosureBlockSize];
  147.                             unsigned long            fBuffOffset;                // where we are in the buffer, 0 based
  148.                             unsigned long            fBuffSize;                    // offset to the last byte of content (logical buffer size).
  149.                                                                                 // for now physical buffEnd is always (fEnumBlocksBuffer+1023)
  150.                             
  151.                             Boolean                    fHasEnclosure;
  152.                             Boolean                    fEnclosureStart;
  153.                             Boolean                    fEnclosureEnd;
  154.                             Boolean                    fEnclosedFileEnd;
  155.                             
  156.                             CEnclosFileSummaryList*    fEnclosureList;
  157.                             
  158.                             unsigned long            fCurrFileIndex;
  159.                             unsigned long            fEnclosuresCount;
  160.                             
  161.                             
  162.                             FInfo                    fFileInfo;
  163.                             FXInfo                    fFileXInfo;
  164.                             
  165.                             char                    fHFSHeader[32];
  166.  
  167.                             Str255                    fCurrFileName;
  168.                             unsigned long            fFileSize;
  169.                             
  170.                             unsigned long            fEnclosuresSize;
  171.                             
  172.                             unsigned short            fNumberOfEntries;
  173.                             
  174.                             long                    fMagicNumber;
  175.                             long                    fFileFormatVersion;
  176.                             EntryDescriptor            fFileEntryDescriptor[10];
  177.                             
  178.                             unsigned long            fDataForkOffset;
  179.                             unsigned long            fDataForkLength;
  180.                             
  181.                             unsigned long            fResourceForkOffset;
  182.                             unsigned long            fResourceForkLength;
  183.                                                         
  184.                             unsigned long            fFileCreationDate;
  185.                             unsigned long            fFileModificationDate;
  186.                             
  187.                             TAOCEEncList*            fEncList;
  188.                             
  189.  
  190. };
  191.  
  192. #endif __TAOCEEnclosure__
  193.  
  194.  
  195.